const express = require('express')
const path = require('path')
const app = express()
app.listen(3000, '0.0.0.0', () => console.log('http://localhost:3000'))
app.use(express.static('./public'))
app.use(express.urlencoded({ extended: false }))
app.use(express.json())

app.get('/now', (req, res) => {
  // 看看有没有最新的数据，如果没有最新的数据让你就等一会 while(true)
  let timer = setInterval(() => {
    let seconds = new Date().getSeconds()
    if (seconds == 50) {
      res.send('' + Date.now())
      clearInterval(timer)
    }
  }, 1000);
})
